<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <script type="text/javascript" src="js/jsAddress.js"></script>
  <title>e网批发管理后台</title>
  <script type="text/javascript" src="js/jquery.min.js"></script>
  <link href="css/styles.css" rel="stylesheet" type="text/css" />
  <link href="css/style2.css" rel="stylesheet" type="text/css" />
<?php 
include("common/conn.php");  
include("tool/UpFileTool.class.php");
/*if($_GET['action']=="ok"){ 
  if ($_FILES[images][name]!='') {
    $UpFileTool=new UpFileTool('images');
    $images=$UpFileTool->upFile();

  if (empty($_POST[cateids])) {
    $cateids = '';
  }else{
    $cateids = implode(',', $_POST[cateids]);
  }
  $query = mysql_query("INSERT INTO home_activity (name,cateids,images,type) VALUES ('".$_POST[name]."','".$cateids."','".$images."',0)");

    echo "<script>alert('添加成功!');window.location.href='saohuo.php'</script>";
  }else{
    echo "<script>alert('未上传图片!');window.location.href='saohuo.php'</script>";
  }
  
}*/


if($_GET['ch']=="ok"){
  if ($_FILES[images][name]!='') {
    $UpFileTool=new UpFileTool('images');
    $images=$UpFileTool->upFile();
    $query = mysql_query("UPDATE h_activity_fenl_tu set images='".$images."' where id=".$_POST[id]);
  }
  echo "<script>alert('更新成功!');window.location.href='paihangbang_img.php?type=".$_POST[type]."'</script>";
}

if ($_GET[id]!='') {
  $rert30 = mysql_query("select * from h_activity_fenl_tu  where id=".$_GET[id]);
  $sdg30 = mysql_fetch_array($rert30);
  $rert31 = mysql_query("select * from categroy  where cateid=".$sdg30[cateid]);
  $sdg31 = mysql_fetch_array($rert31);
}
?>

</head>

<body>

  <!--header-->
  <?php include("common/header.php");?>
  <!--header end-->
  <div id="sub_nav">

    <div id="subnav_wrap" class="container_12">

      <!-- start sub nav list -->
      <div id="subnav" class=" grid_12">
        <ul>
          <li><a href="paihangbang.php?type=4">属性设置</a></li>
          <li><a href="paihangbang_img.php?type=4"   class="sub_nav_active">分类活动图片</a></li>
        </ul>
      </div>

    </div>


  </div>

  <div class="container_12">
    <form action="?<?php if($_GET['id']!=""){echo "ch=ok";}else{echo "action=ok";} ?>" method="post" enctype="multipart/form-data"> 
      <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td width="30%" scope="col"><label>名称</label></td>
          <td width="50%" scope="col">
            <label><?php echo $sdg31[name]?$sdg31[name]:'全部';?></label>
          </td>
        </tr>
        <tr>
          <td width="30%" scope="col"><label>图片</label></td>
          <td width="50%" scope="col">
            <input name="images" type="file" class="text"/>
          </td>
        </tr>
        <?php if($sdg30[images]!='') { ?>
        <tr>
          <td width="30%" scope="col"></td>
          <td width="50%" scope="col">
            <img src="<?php echo $sdg30[images]; ?>" style="height:auto;width:250px;">
          </td>
        </tr>
        <?php } ?>
      
        <tr>
          <td width="40%" scope="col"></td>
          <td width="50%" scope="col">
            <input name="type" type="hidden" value="<?php echo $sdg30[activity_id]; ?>" />
            <input name="id" type="hidden" value="<?php echo $_GET[id];?>" />
            <input name="" type="submit" value="提交" class="submit" />
          </td>
        </tr>
        </table>

      </form>
    </div>

  </form>


</body>
</html>
